#pragma once
#include <SFML/Graphics/Text.hpp>
#include <nice2d/widgets/control.h>

class BasicButtonStyle : public ControlStyle
{
    DECLARE_OBJECT(BasicButtonStyle)
public:
    BasicButtonStyle();
    virtual ~BasicButtonStyle();
};

enum BasicButtonState {
    BasicButtonState_Normal = 0,
    BasicButtonState_Down,
    BasicButtonState_Hover
};

class BasicButton : public Control
{
    DECLARE_OBJECT(BasicButton)
public:
    BasicButton(const sf::Vector2f &size = sf::Vector2f(96, 36));
    virtual ~BasicButton();
public:
    boost::signals2::signal<void(std::shared_ptr<BasicButton>)> pressed;
    boost::signals2::signal<void(std::shared_ptr<BasicButton>)> released;
protected:
    BasicButtonState getButtonState()const;

    virtual void onMouseEnter() override;
    virtual void onMouseExit() override;
    virtual void onMousePressed(sf::Mouse::Button button) override;
    virtual void onMouseReleased(sf::Mouse::Button button) override;

    virtual void onButtonStateChanged();

    virtual void onStyleChanged()override;
private:
    std::unique_ptr<class BasicButtonData> data;
};
